package com.lqk.demo.atomic.unsafe;

import sun.misc.Unsafe;

import java.lang.reflect.Field;

/**
 * @author lqk
 * @date 2022/1/4 14:51
 */
public class TestUnsafe1 {
    public static void main(String[] args) throws NoSuchFieldException, IllegalAccessException {
        Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
        theUnsafe.setAccessible(true);  // 允许访问私有成员变量
        Unsafe unsafe = (Unsafe)theUnsafe.get(null);

        System.out.println(unsafe);
    }
}
